package com.liang.service.impl;


import com.liang.empty.UserAndRoleInfor;
import com.liang.pojo.Userzandrolez;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import com.liang.mapper.UserzandrolezDAO;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.liang.service.UserzandrolezService;
/**
 *@作者:lsk
 *Service实现类
 *@Date:2023/10/14
*/
@Service
public class UserzandrolezServiceImpl  implements UserzandrolezService{


	@Resource
	private UserzandrolezDAO userzandrolezdao;

	/**
	 *查询一个用户的角色
	 */
	@Override
	public List<UserAndRoleInfor> selectUserRole(String user_id) {
		return userzandrolezdao.selectUserRole(user_id);
	}
	/**
	 *查询一个用户的角色2
	 */
	@Override
	public List<UserAndRoleInfor> selectUserRoleTwo(Map param) {
		if(param.get("pageNum") != null){
			int start = Integer.parseInt(param.get("pageSize").toString()) * (Integer.parseInt(param.get("pageNum").toString()) - 1);
			param.put("pageNum",start);
		}
		return userzandrolezdao.selectUserRoleTwo(param);
	}
	/**
	 * 删除用户角色
	 */
	@Override
	public Integer deleteUserRole(Map param) {
		return userzandrolezdao.deleteUserRole(param);
	}

	/**
	 insert:(插入)
	*/
	public Object insert(Userzandrolez demo){
		userzandrolezdao.insertlsk(demo);
		return demo;
	}



	/**
	 insertOrUpdate(插入或更新(根据主键或唯一索引更新，主键和唯一索引不会改变))
	*/
	public Integer insertOrUpdate(Userzandrolez demo){
		return userzandrolezdao.insertOrUpdatelsk(demo);
	}



	/**
	 insertBath:(批量插入)
	*/
	public Integer insertBatch(List<Userzandrolez> list){
		return userzandrolezdao.insertBatchlsk(list);
	}



	/**
	 insertOrUpdateBatch:(批量插入或更新)
	*/
	public Integer insertOrUpdateBatch(List<Userzandrolez> list){
		return userzandrolezdao.insertOrUpdateBatchlsk(list);
	}



	/**
	 selectList:(根据参数查询集合)
	*/
	public List<Userzandrolez> selectList(Map<String,Object> param){
		if(param.get("pageNum") != null){
			int start = Integer.parseInt(param.get("pageSize").toString()) * (Integer.parseInt(param.get("pageNum").toString()) - 1);
			param.put("pageNum",start);
		}
		return userzandrolezdao.selectListlsk(param);
	}



	/**
	 selectCount:(根据集合查询数量)
	*/
	public Long selectCount(Map<String,Object> param){
		return userzandrolezdao.selectCountlsk(param);
	}



}